<ul id="review" data-page="1" data-id="0">
<#list page.content as r>
<div class="rev-list" id ="_j_reply_list" >
    <ul>
        <li class="rev-item comment-item clearfix">
            <div class="user"><a class="avatar" href="/mine/homepage" target="_blank"><img
                    src="${r.headUrl}"
                    width="48" height="48"></a><span class="level"></span></div>
            <a class="useful" title="点赞"  data-id="${r.id}" id="thumbUp"><i></i><font class="useful-num" >${r.thumbNum}</font>
            </a>
            <a class="name" href="/u/52068941.html" target="_blank" >${r.username}</a>
            <span class="s-star s-star${r.totalStarNum}"></span>
            <p class="rev-txt">${r.reviewContent}</p>


            <div class="rev-img">
                <a href="/photo/poi/25091_440424016.html" target="_blank"><img
                        src="${r.reviewPicUrls}"
                        width="200" height="120"></a>

            </div>
            <div id="sightId" data-id="${r.sightId}"></div>
            <div class="info clearfix">
                <a class="btn-comment _j_comment" title="添加评论">评论</a>
                <span class="createTime" >${(r.createTime)?string("yyyy-MM-dd HH:mm:ss")}</span>
                <span class="from">
                                此条点评来自游记<a href="/i/12601474.html" target="_blank">《南国花城正月中 ——2019年春节广州记（含长...》</a>
                            </span>
            </div>
           <#list r.rcs as rc>
            <div class="comment add-reply ">
                <ul class="more_reply_box comment_list">
                    <li>
                        <a href="/u/63107989.html" target="_blank">
                            <img src="${(rc.headUrl)!}"
                                 width="16" height="16">${(rc.username)!}
                        </a>
                    ${(rc.comment)!}
                        <a class="_j_reply re_reply" ata-uid="63107989"
                           data-username="🍓辣辣辣辣王🍓" title="添加回复" ></a>
                        <br><span class="time">${((rc.createTime)?string("yyyy-MM-dd HH:mm:ss"))!}</span>
                    </li>

                </ul>

            </div>
           </#list>

        </li>

    </ul>
</div>

    <div class="reply-text" >
        <form id="replyForm" action="/reviewComment" method="post">
        <input type="hidden" name="refComment.id" id="refCommentId">
        <div class="add-comment hide reply-form">
                                    <textarea id="comment_reply" name="comment" class="comment_reply" data-comment_id=""
                                              data-comment_username="" data-poi_id="25091" data-poi_name="广州塔"
                                              data-parent_id="" data-parent_uid="" data-parent_username=""
                                              style="background-color:#cccccc;color=red"></textarea>
            <a class="btn btn_submit_reply commentBtn"  data-user='${(userInfo)!}'  data-id="${r.id}">回复</a>
        </div>
        </form>

    </div>
</#list>
    <div style="float: right">
        <div style="float: left;" ><span style="line-height:30px"> 共${page.totalPages!}页 / ${page.totalElements}条&nbsp;&nbsp;&nbsp;</span></div>
        <div id="pagination" class="jq-pagination" style="display: inline;"></div>
    </div>
    <script>
        $("#pagination").jqPaginator({
                    totalPages: ${page.totalPages!0},
                    visiblePages: 5,
                    currentPage: ${page.number+1} || 1,
                prev: '<a class="prev" href="javascript:void(0);">上一页<\/a>',
                next: '<a class="next" href="javascript:void(0);">下一页<\/a>',
                page: '<a href="javascript:void(0);">{{page}}<\/a>',
                last: '<a class="last" href="javascript:void(0);" >尾页<\/a>',
                onPageChange: function(page, type) {
            if(type == 'change'){
                $("#currentPage").val(page);
                $("#searchForm").submit();
            }

        }
        })

        $(function(){
            $(".useful").click(function(){
                var rid = $(this).data("id");
                var num = $(this).children().eq(1);
                $.ajax({
                      type:"get",
                      url:"/addThumb",
                      data:{rid:rid},
                      success:function(data){
                      if(data.success){
                          $(num).html(data.data);

                      }else{
                          popup(data.msg);
                      }
                      }
                })
            })

             })
        $(function() {
            //回复功能
            $(".commentBtn").click(function () {
                var user = this.getAttribute("data-user");
                //如果用户没有登录跳转到登录页面
                if (user == null || user == "") {
                    popup("请先登录");
                    setTimeout(function () {
                        window.location.href = "http://localhost:8888/login.html";
                    }, 1000);

                }
                //如果评论为空就返回
                if (!$(".commentBtn").val) {
                    popup("评论不能为空");
                    return;
                }
                //获取点评的id
                var reviewId = $(this).data("id");
                //获取回复的内容
                var comment = $(this).prev().val();

                $.ajax({
                    type: "post",
                    url: "/reviewComment",
                    data: {reviewId: reviewId, comment: comment},
                    success: function (data) {
                        var parent =  $(this).parent("div").parent('div').prev();
                        $(parent).append(data);
                        //发送请求自动刷新页面
                        var sightId = $("#sightId").data("id");
                       setTimeout(function(){ window.location.href="/detail?sightId="+sightId;});
                    }


                })
            })

        })


    </script>
</ul>